package com.molichuxing.gateway.exception;

import java.util.HashMap;
import java.util.Map;

/**
 * dealer服务错误码
 * 
 * @author zoumingyu
 * @date 2019年9月24日
 *
 */
public enum DealerExceptionCodeEnum {
	/**
	 * 门店已暂停营业
	 */
	STORE_SUSPENSION(11501, "本门店已暂停营业"),
	/**
	 * 门店强制关店
	 */
	STORE_CLOSE(11502, "本门店已关店"),
	/**
	 * 经销商已暂停营业
	 */
	DEALER_SUSPENSION(11501, "本经销商已暂停营业"),
	/**
	 * 经销商终止合作
	 */
	DEALER_CLOSE(11512, "本经销商已终止合作");

	final static private Map<Integer, DealerExceptionCodeEnum> MAP = new HashMap<Integer, DealerExceptionCodeEnum>() {
		private static final long serialVersionUID = -8414553247670306999L;
		{
			DealerExceptionCodeEnum[] enums = DealerExceptionCodeEnum.values();
			for (DealerExceptionCodeEnum OrderExceptionCodeEnum : enums) {
				put(OrderExceptionCodeEnum.getCode(), OrderExceptionCodeEnum);
			}
		}
	};

	public static DealerExceptionCodeEnum getEnum(Integer code) {
		return MAP.get(code);
	}

	public static String getEnumDesc(Integer code) {
		DealerExceptionCodeEnum OrderExceptionCodeEnum = MAP.get(code);
		if (OrderExceptionCodeEnum != null) {
			return OrderExceptionCodeEnum.getMessage();
		}
		return "";
	}

	private Integer code;

	private String message;

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	private DealerExceptionCodeEnum(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
}
